package net.xinshi.domain;

import com.alibaba.fastjson.annotation.JSONField;
import net.xinshi.utils.DateUtils;
import net.xinshi.utils.ErrorCode;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.io.Serializable;
import java.util.Date;

public class JsonResponseObject implements Serializable {
    private static final long serialVersionUID = -4764855484776887060L;

    @JsonProperty("RETURN_CODE")
    private String code;
    @JsonProperty("RETURN_DESC")
    private String msg;
    @JSONField(format = "yyyy-MM-dd hh:mm:ss")
    @JsonProperty("RETURN_STAMP")
    private String timestamp = DateUtils.formatDatetime(new Date());
    @JsonProperty("RETURN_DATA")
    private Object data;

    public JsonResponseObject() {
        super();
        this.code = ErrorCode.SUCCESS.getCode();
        this.msg = ErrorCode.SUCCESS.getMsg();
    }


    public JsonResponseObject(String code, String msg) {
        super();
        this.code = code;
        this.msg = msg;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public String getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(Date timestamp) {
        this.timestamp = DateUtils.formatDatetime(timestamp);
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
